/*!--------------------------------------------------------------------------
 @file siconst.h
 @date 12/14/2010

 Const data.

*/
/*

 Copyright (c) 2010, XInfo
 All rights reserved.

 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:

    * Redistributions of source code must retain the above copyright notice,
    this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in the
    documentation and/or other materials provided with the distribution.
    * Neither the name of the XInfo nor the names of its contributors may be
    used to endorse or promote products derived from this software without
    specific prior written permission.

 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/

#ifndef SI_CONST_H
#define SI_CONST_H

C_BEGIN_DECLS

/*! Depth */
#define SI_8U 0                                             /*!< Unsigned char value */
#define SI_8S 1                                             /*!< Char value */
#define SI_16U 2                                            /*!< Unsigned short value */
#define SI_16S 3                                            /*!< Short value */
#define SI_32S 4                                            /*!< Integer value */
#define SI_32F 5                                            /*!< Float value */
#define SI_64F 6                                            /*!< Double value */

#define SI_CHANNELS_SHIFT 3                                 /*!< Channels shift (depth need 3 bits) */

#define SI_DEPTH_MAX (1 << SI_CHANNELS_SHIFT)               /*!< Depth maximum */
#define SI_DEPTH_MASK (SI_DEPTH_MAX - 1)                    /*!< Depth mask */
/*! Get depth */
#define SI_GET_DEPTH(flags) ((flags) & SI_DEPTH_MASK)
/*! Get depth size

 Flags      Depth size
 SI_8*      1
 SI_16*     2
 SI_32*     4
 SI_64*     8
*/
#define SI_GET_DEPTH_SIZE(flags) (1 << (SI_GET_DEPTH(flags) >> 1))

#define SI_CHANNELS_MAX 8                                   /*!< Channels maximum */
#define SI_CHANNELS_MASK (SI_CHANNELS_MAX - 1)              /*!< Channels mask */
/*! Get channels */
#define SI_GET_CHANNELS(flags) ((((flags) >> SI_CHANNELS_SHIFT) & SI_CHANNELS_MASK) + 1)

/*! Matrix type mask */
#define SI_MATRIX_TYPE_MASK (SI_DEPTH_MAX * SI_CHANNELS_MAX - 1)
/*! Get matrix type */
#define SI_GET_MATRIX_TYPE(flags) ((flags) & SI_MATRIX_TYPE_MASK)

/*! Make type */
#define SI_MAKE_TYPE(depth, channels) (SI_GET_DEPTH(depth) + (((channels) - 1) << SI_CHANNELS_SHIFT))

/*! Border type */
#define SI_BORDER_CONSTANT 0                                /*!< Const value */
#define SI_BORDER_REPLICATED 1                              /*!< Replicated value */

/*! Kernel type */
#define SI_KERNEL_GENERAL 0                                 /*!< General */
#define SI_KERNEL_SYMMETRICAL 1                             /*!< Symmetrical (Anchor is at center) */
#define SI_KERNEL_ASYMMETRICAL 2                            /*!< Asymmetrical (Anchor is at center) */
#define SI_KERNEL_SMOOTH 4                                  /*!< Smooth (All elements are equal or above 0) */
#define SI_KERNEL_INTEGER 8                                 /*!< Integer (All elements are integer) */

/*! Small Gaussian table */
#define SMALL_GAUSSIAN_SIZE 7
const float small_gaussian_table[][SMALL_GAUSSIAN_SIZE] =
{
    {1.0},
    {0.25, 0.5, 0.25},
    {0.0625, 0.25, 0.375, 0.25, 0.0625},
    {0.03125, 0.109375, 0.21875, 0.28125, 0.21875, 0.109375, 0.03125}
};

C_END_DECLS

#endif  // SI_CONST_H

